package inutan.game.proto;

import inutan.game.entity.UserInfo;
import luban.user.RoleInfo;

/**
 * 统一管理 协议构建
 */
public class UserProto {

    /**
     * 构建推送客户端协议体
     * @param userInfo
     * @return
     */
    public static RoleInfo createRoleInfo(UserInfo userInfo) {
        RoleInfo roleInfo = new RoleInfo();
        roleInfo.userName = userInfo.getUserName();
        roleInfo.createTime = userInfo.getCreateTime();
        roleInfo.level = userInfo.getLevel();
        roleInfo.exp = userInfo.getExp();
        roleInfo.gold = userInfo.getGold();
        roleInfo.sex = userInfo.getSex();
        roleInfo.prelude = userInfo.getPrelude();
        roleInfo.diamond = userInfo.getDiamond();
        roleInfo.greetings = userInfo.getGreetings() == null ? "" : userInfo.getGreetings();
        return roleInfo;
    }
}
